using System;
using System.Collections.Generic;
using System.Text;

namespace HiSun.Model
{
    public class GroupInfo
    {
        protected int _groupId;
        protected string _className = String.Empty;
        protected string _classPWD = String.Empty;
        protected int _studCount;
        protected short _enYear;
        protected DateTime _regDate;
        protected int _visitCount;
        protected string _homepage = String.Empty;
        protected string _creator = String.Empty;
        protected string _pronouncement = String.Empty;
        protected int _openLevel;
        protected byte _isAppendShow;
        protected string _admin1 = String.Empty;
        protected string _admin2 = String.Empty;
        protected short _teacherNum;
        protected int _exponent;
        protected string _guestRights = String.Empty;
        protected string _committRights = String.Empty;

        public GroupInfo()
        {
        }

        public GroupInfo(int groupId, string groupName, int exponent)
        {
            this._groupId = groupId;
            this._className = groupName;
            this._exponent = exponent;
        }

        public GroupInfo(int groupId,
            string groupName,
            string classPWD,
            int studCount,
            short enYear,
            DateTime regDate,
            int visitCount,
            string homepage,
            string creator,
            string pronouncement,
            int openLevel,
            byte isAppendShow,
            string admin1,
            string admin2,
            short teacherNum,
            int exponent,
            string guestRights,
            string committRights)
        {
            this._groupId = groupId;
            this._className = groupName;
            this._classPWD = classPWD;
            this._studCount = studCount;
            this._enYear = enYear;
            this._regDate = regDate;
            this._visitCount = visitCount;
            this._homepage = homepage;
            this._creator = creator;
            this._pronouncement = pronouncement;
            this._openLevel = openLevel;
            this._isAppendShow = isAppendShow;
            this._admin1 = admin1;
            this._admin2 = admin2;
            this._teacherNum = teacherNum;
            this._exponent = exponent;
            this._guestRights = guestRights;
            this._committRights = committRights;
        }


        //public GroupInfo(int id)
        //{
        //    SqlService sql = new SqlService();
        //    sql.AddParameter("@ClassID", SqlDbType.Int, id);
        //    SqlDataReader reader = sql.ExecuteSqlReader("SELECT * FROM FH_Class WHERE ClassID = '" + id.ToString() + "'");

        //    if (reader.Read())
        //    {
        //        this.LoadFromReader(reader);
        //        reader.Close();
        //    }
        //    else
        //    {
        //        if (!reader.IsClosed) reader.Close();
        //        throw new ApplicationException("FH_Clas does not exist.");
        //    }
        //}

        //public GroupInfo(SqlDataReader reader)
        //{
        //    this.LoadFromReader(reader);
        //}

        //protected void LoadFromReader(SqlDataReader reader)
        //{
        //    if (reader != null && !reader.IsClosed)
        //    {
        //        _id = reader.GetInt32(0);
        //        if (!reader.IsDBNull(1)) _className = reader.GetString(1);
        //        if (!reader.IsDBNull(2)) _classPWD = reader.GetString(2);
        //        if (!reader.IsDBNull(3)) _studCount = reader.GetInt32(3);
        //        if (!reader.IsDBNull(4)) _enYear = reader.GetInt16(4);
        //        if (!reader.IsDBNull(5)) _regDate = reader.GetDateTime(5);
        //        if (!reader.IsDBNull(6)) _visitCount = reader.GetInt32(6);
        //        if (!reader.IsDBNull(7)) _homepage = reader.GetString(7);
        //        if (!reader.IsDBNull(8)) _creator = reader.GetString(8);
        //        if (!reader.IsDBNull(9)) _pronouncement = reader.GetString(9);
        //        if (!reader.IsDBNull(10)) _openLevel = reader.GetInt32(10);
        //        if (!reader.IsDBNull(11)) _isAppendShow = reader.GetByte(11);
        //        if (!reader.IsDBNull(12)) _admin1 = reader.GetString(12);
        //        if (!reader.IsDBNull(13)) _admin2 = reader.GetString(13);
        //        if (!reader.IsDBNull(14)) _teacherNum = reader.GetInt16(14);
        //        if (!reader.IsDBNull(15)) _exponent = reader.GetInt32(15);
        //        if (!reader.IsDBNull(16)) _guestRights = reader.GetString(16);
        //        if (!reader.IsDBNull(17)) _committRights = reader.GetString(17);
        //    }
        //}

        #region Public Properties
        public int GroupId
        {
            get { return _groupId; }
            set { _groupId = value; }
        }

        public string ClassName
        {
            get { return _className; }
            set { _className = value; }
        }

        public string ClassPWD
        {
            get { return _classPWD; }
            set { _classPWD = value; }
        }

        public int StudCount
        {
            get { return _studCount; }
            set { _studCount = value; }
        }

        public short EnYear
        {
            get { return _enYear; }
            set { _enYear = value; }
        }

        public DateTime RegDate
        {
            get { return _regDate; }
            set { _regDate = value; }
        }

        public int VisitCount
        {
            get { return _visitCount; }
            set { _visitCount = value; }
        }

        public string Homepage
        {
            get { return _homepage; }
            set { _homepage = value; }
        }

        public string Creator
        {
            get { return _creator; }
            set { _creator = value; }
        }

        public string Pronouncement
        {
            get { return _pronouncement; }
            set { _pronouncement = value; }
        }

        public int OpenLevel
        {
            get { return _openLevel; }
            set { _openLevel = value; }
        }

        public byte isAppendShow
        {
            get { return _isAppendShow; }
            set { _isAppendShow = value; }
        }

        public string Admin1
        {
            get { return _admin1; }
            set { _admin1 = value; }
        }

        public string Admin2
        {
            get { return _admin2; }
            set { _admin2 = value; }
        }

        public short TeacherNum
        {
            get { return _teacherNum; }
            set { _teacherNum = value; }
        }

        public int Exponent
        {
            get { return _exponent; }
            set { _exponent = value; }
        }

        public string GuestRights
        {
            get { return _guestRights; }
            set { _guestRights = value; }
        }

        public string CommittRights
        {
            get { return _committRights; }
            set { _committRights = value; }
        }
        #endregion

        //public static FH_Clas GetFH_Clas(int id)
        //{
        //    return new FH_Clas(id);
        //}
      
    }

    public enum GroupType
    {
        Class = 0,
        University = 1,
        City = 2,
        Interest = 3
    }
}